;;; packages - package definitions for GNU Guix
;;; Copyright (C) 2016, 2017 ng0
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Affero General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (ng0 packages qt)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build utils)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system gnu)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages flex)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnuzilla)
  #:use-module (gnu packages gperf)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages image)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages pciutils)
  #:use-module (gnu packages pcre)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages python)
  #:use-module (gnu packages ruby)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages xml))

;; Broken, outdated.
;; As far as I know this requires qt =< 5.3 ? and is only needed for secushare prototype2014.
(define-public qzxing
  (let ((commit "ee5b3e62a384a418918e9fc92c1caa05dfd38be5"))
    (package
      (name "qzxing")
      (version (string-append "0.0." (string-take commit 7)))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/dplanella/qzxing")
               (commit commit)))
         (file-name (string-append name "-" version "-checkout"))
         (sha256
          (base32
           "1wws7c9ix6h2ljwi697gkxvq46djad50r6hl1p2algz1rxc1wmw9"))))
      (build-system gnu-build-system)
      (arguments
       `(#:tests? #f ; no tests exist
         #:phases
         (modify-phases %standard-phases
           (replace 'configure
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
                 (zero?
                  (system* "qmake" (string-append "PREFIX=" out)))))))))
      (inputs
       `(("qtbase" ,qtbase)
         ("qtdeclarative" ,qtdeclarative)
         ("python-pyqt" ,python-pyqt)))
      (home-page "https://github.com/dplanella/qzxing")
      (synopsis
       "Qt Quick 2.0 port of the ZXing multi-format 1D/2D barcode
image processing library")
      (description
       "Qt Quick 2.0 port of the ZXing multi-format 1D/2D barcode
image processing library")
      (license license:asl2.0))))

(define-public qzxing-fork
  (let ((commit "967a48f8cbc021f2bd6ef25d503e405cdfcac37d"))
    (package
      (inherit qzxing)
      (name "qzxing-bratao")
      (version (string-append "0.0." (string-take commit 7)))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/bratao/qzxing")
                      (commit commit)))
                (file-name (string-append name "-" version "-checkout"))
                (sha256
                 (base32
                  "1i535k14h6j8yfszxky81z1m7sf02bcr1bzw8v4i0b72hjri98ba")))))))
